/** esline-disable */
{
    // ES3,ES5
    var evens = [1, 2, 3, 4, 5]
    var odds = evens.map(function (value) {
        return value + 1
    })
    console.log(evens, odds)
}

{
    // ES6
    let evens = [1, 2, 3, 4, 5]
    let odds = evens.map(value => value + 1)
    console.log(evens, odds);
}

{
    class factory {
        constructor() {
            this.a = 'a';
            this.b = 'b';
            this.c = {
                a: 'a+',
                b: function () {
                    return this.a;
                }
            };
        }
    }
    console.log(new factory().c.b()) // a+
}

{
    var factory = function () {
        this.a = 'a'
        this.b = 'b'
        this.c = {
            a: 'a+',
            b: () => {
                return this.a
            }
        }
    }
    console.log(new factory().c.b()) // a

    const user = {
        name: 'jean',
        hobbies: ['coding', 'reading', 'playing'],
        printHobbies: function () {
            this.hobbies.map(hobby => {
                console.log(`${this.name} loves ${hobby}`);
            })
        }
    }

    user.printHobbies();
}
